﻿using System;
using System.Collections.Generic;
using Pixume.World.Cubes;
using Pixume.World.Chunks;

namespace Pixume.World.Terrain
{
    class SphereGenerator
    {
        private static int CHUNK_SIZE = 15;
#region Construtors 
        static SphereGenerator()
        {
        }

        
#endregion

        public Chunk generateSphere(String pCubeType)
        {
            Chunk returnChunk = new Chunk();
            
            for (int z = 0; z < CHUNK_SIZE; z++)
            {
                for (int y = 0; y < CHUNK_SIZE; y++)
                {
                    for (int x = 0; x < CHUNK_SIZE; x++)
                    {
                        if (Math.Sqrt((float)(x - CHUNK_SIZE / 2) * (x - CHUNK_SIZE / 2) + (y - CHUNK_SIZE / 2) * (y - CHUNK_SIZE / 2) + (z - CHUNK_SIZE / 2) * (z - CHUNK_SIZE / 2)) <= CHUNK_SIZE / 2)
                        {
                            
                            returnChunk.ChangeBlock(pCubeType,x,y,z);
                        }
                    }
                }
            }
            return returnChunk;
        }
    }
}
